package com.jay.media.music.core.db

import androidx.room.*

/**
 * @author xuzhou4
 * @date 2022/2/14
 */
@Dao
interface MusicDao {

    @Query("select * from music")
    fun getAllMusicList(): List<Music>

    @Query("select * from music where data = (:data)")
    fun queryByData(data: String): Music?

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    fun insert(music: Music)

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    fun insert(music: List<Music>)

    @Update
    fun update(music: Music)

    @Update
    fun update(musics: List<Music>)

    @Query("select * from music where playListType = 1 order by playListTime desc")
    fun queryPlayList(): List<Music>

    @Query("select * from music where favorType = 1 order by favorTypeTime desc")
    fun queryFavorList(): MutableList<Music>

    @Query("select * from music where playHistoryType = 1 order by playHistoryTime desc")
    fun queryPlayHisList(): List<Music>
}